﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jquery.IDAL;
using Jquery.DAL;
namespace Jquery.BLL
{
    public class BllBaseService<T> where T : class,new()
    {
        public IDBsession DbSession
        {
            get
            {
                return new DBsession();
            }
        }
        /// <summary>
        /// 获取或设置当前仓储对象
        /// </summary>
        public IBaseRepository<T> CurrentRepository { get; set; }
        /// <summary>
        /// 强制子类实现设置当前要用的仓储对象
        /// </summary>
        public abstract void SetCurrentRepository();


        public void BllBaseService()
        {
            SetCurrentRepository();
        }

        public IQueryable<T> LoadEntities(Func<T, bool> WhereLambda)
        {
            return CurrentRepository.LoadEntities(WhereLambda);
        }
    }
}
